package com.study.aop.theory.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.Date;

/**
 * @author: chenhs
 * @date: Created in 9:32 2020/4/6
 **/
public class KtvInvocationHandler implements InvocationHandler {

    private Object target;

    public KtvInvocationHandler(Object targetObject) {
        this.target = targetObject;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("进入了代理\n");
        Object result = method.invoke(target, args);
        System.out.println("时间为："+ new Date()+"\n\n");
        return result;
    }
}
